#delimit;
clear all;
set more off;
*capture log using "00_Master_File.log", replace;

/*******************************************************************************************/;
** INPUT: This is the master do file that runs the main do files;
**  To run, you need a "Raw Data" folder nested at the same level as this "Data Management" folder;
**	The "Raw Data" folder will contain 8 subfolders;
** 			1. "AWS" with Amazon web service variables on IRS form 990 for grantees;
**			2. "Chetty Inequality Data" with Neighborhood Characteristics by Census Tract;
**			3. "CPI" with consumer price index data;
** 			4. "Guidestar" with proprietary digitized tax records for DAFs;
** 			5. "Handcode DAF Classification" with industry subclassification and industry-SIC mappings;
**			6. "NBER" with NBER charity data (i.e., eventual DAF grantees);
**			7. "PDF Copies of 990 Form" that were digitized by RAs to determine investment holdings;
**			8. "Zipcode to FIPS" which has files to convert between zipcode and FIPS;
**	You will need 3 folders within this "Data Management" folder;
**			1. "For Handcode" to identify the orgs that need PDFs downloaded;
**			2. "Figures" to output the figures;
**			3. "tex" for regression and table output;
** OUTPUT: Tableas and figures for Grennan, J., 2022. "Social Change through Financial Innovation: Evidence from Donor-advised Funds," Review of Corporate Finance Studies ;
** STATA PACKAGE INPUT: REGHDFE;
** RUN TIME: approx. 15 minutes;
/*******************************************************************************************/;

** STATA PACKAGE TO INSTALL;
 ssc install reghdfe;

** STATA VERSION CONTROL;
version 15;

** RUNNING FILES IN DATA MANAGEMENT FOLDER;
do "01_Prepare_Guidestar_Basic.do";
do "02_Readin_Handcode_DAF_Classification.do";
do "03_Readin_Handcode_Investments_and_Classify.do";
do "04_Prepare_Grantee_NBER_and_AWS_Data.do";
do "05_Merge_Grants_Data_and_Chetty_Inequality.do";
do "06_Merge_Grantee_Financial_and_Governance_Data_with_DAFs.do";
do "07_DAF_Classification_Summary_Table.do";
do "08_DAF_Investment_Summary_Table.do";
do "09_DAF_Grantee_Summary_Table.do";
do "10_DAF_Liquidity_Transformation_Regressions.do";
do "11_DAF_Grantee_Regressions.do";
do "12_Compare_Growth_DAF_Figures.do";
do "13_Create_NAICS_Appx_Table.do";

